<?php
        class dmmanager extends model {
           
           function view(){ 
           
           $folder="/dmmanager";
           
           if($this->info['parameter'][0])
           {
             $file=$this->info['parameter'][0];

             if($file=='statistic')
             {
               
                   
                   $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/stat.css'; 
                    $arraynewdata['stat']['feature']= $this->countpostallfeature() ;
                    $arraynewdata['stat']['user']= $this->countmemberall() ;
                    $arraynewdata['stat']['tag']= $this->counttagall() ;
             }else if($file=='pactivity')
             {
             $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/backend.css'; 
             }
             else if($file=='statisticreport')
             {
             
             $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/stat.css';     
             $arraynewdata['bodyset']='clBg3'; 
             if($_GET['report'])
             {
               $page=1;
               if($_GET['page'])
               
               
               {
               $page=$_GET['page'];
               }
               $limitdata=1;
               if($_GET['nopage'])
               {
               $limitdata=0;
               }
               $arrayreport=$this->getreport($_GET['report'],$_GET['fid'],$_GET['status'],$page,$limitdata) ;
               $arraynewdata['report']=$arrayreport;

               $arraynewdata['numrowpage']=ceil($arraynewdata['report']['countall']/100);
               if($arraynewdata['numrowpage']==0)
               {
               $arraynewdata['numrowpage']=1;
               }
               $arraynewdata['pagenow']=$page;
               $arraynewdata['limitdata']=$limitdata;
               


             
             }
             
             $this->loaddata('statisticreport',$arraynewdata,$folder);
             exit;
             }
             else if($file=='featuremanager')
             {
             
             $arraynewdata['pluginsdata']=$this->getpluginfeature();
             $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/backend.css'; 
             
                  $sql="SHOW TABLES LIKE 'tb_feature'";
                 $arraycheck=$this->db->db_set_1recordrow($sql);
                 if(count($arraycheck))
                 {
             $sql='select * from tb_feature order by position asc' ;
             $featurearr=$this->db->db_set_recordset($sql);
             if(count($featurearr))
             {
             $k=0;
             foreach($featurearr as $valuefeature)
             {
             if($valuefeature['config'])
             {
             $dataarray=json_decode($valuefeature['config']);
             $featurearr[$k]['config']=object_to_array($dataarray);
             
             }
             
             if($valuefeature['fid'])
             {
             
             $sql="select * from tb_feature_plugin where fid=".$valuefeature['fid'];
             $featureplugin=$this->db->db_set_recordset($sql);
             $arrayp=array();
             if(count($featureplugin))
             {
             foreach($featureplugin as $valueplugins2)
             {
             $arrayp[]=$valueplugins2['plugid'];
             
             }
             }
             
             
             $sql='SELECT
tb_tag.`name`
FROM
tb_tag_show
INNER JOIN tb_tag ON tb_tag_show.tagid = tb_tag.tagid
where tb_tag_show.fid='.$valuefeature['fid'].'
';
$featuretag=$this->db->db_set_recordset($sql);
$featurearr[$k]['tag']=$featuretag;
             
             $featurearr[$k]['plugins']=$arrayp;
             
             
             }
             
             $k++;
             
             }
             }
             
              $arraynewdata['pluginsdata']=$this->getpluginfeature();
              $arraynewdata['featuredata']=$featurearr;
//              echo "<pre>";
//              print_r($arraynewdata['featuredata']);
//              echo "</pre>;";
//              exit;
              

                 }
             
             }
             else if($file=='tagmanage')
             {
             $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/backend.css';
             
               $sql="SHOW TABLES LIKE 'tb_feature'";
                 $arraycheck=$this->db->db_set_1recordrow($sql);
                 if(count($arraycheck))
                 {
             $sql='select * from tb_feature order by position asc' ;
             $featurearr=$this->db->db_set_recordset($sql);
             if(count($featurearr))
             {
             $k=0;
             foreach($featurearr as $valuefeature)
             {
             if($valuefeature['config'])
             {
             $dataarray=json_decode($valuefeature['config']);
             $featurearr[$k]['config']=object_to_array($dataarray);
             
             }
             
             if($valuefeature['fid'])
             {
             
             $sql="select * from tb_feature_plugin where fid=".$valuefeature['fid'];
             $featureplugin=$this->db->db_set_recordset($sql);
             $arrayp=array();
             if(count($featureplugin))
             {
             foreach($featureplugin as $valueplugins2)
             {
             $arrayp[]=$valueplugins2['plugid'];
             
             }
             }
             
             
             $sql='SELECT
tb_tag.`name`
FROM
tb_tag_show
INNER JOIN tb_tag ON tb_tag_show.tagid = tb_tag.tagid
where tb_tag_show.fid='.$valuefeature['fid'].'
';
$featuretag=$this->db->db_set_recordset($sql);
$featurearr[$k]['tag']=$featuretag;
             
             $featurearr[$k]['plugins']=$arrayp;
             
             
             }
             
             $k++;
             
             }
             }
             
              $arraynewdata['pluginsdata']=$this->getpluginfeature();
              $arraynewdata['featuredata']=$featurearr;
//              echo "<pre>";
//              print_r($arraynewdata['featuredata']);
//              echo "</pre>;";
//              exit;
              

                 }
             
             
             }
             else if($file=='userscreen')
             {
             $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/backend.css'; 
             $sql="SHOW TABLES LIKE 'tb_feature'";
                 $arraycheck=$this->db->db_set_1recordrow($sql);
                 if(count($arraycheck))
                 {
             $sql='select * from tb_feature order by position asc' ;
             $featurearr=$this->db->db_set_recordset($sql);
             $arraynewdata['feature']=$featurearr;
             
                 }
             
             
             
             }
             else if($file=='game')
             {
             $arraynewdata['expconfig']=$this->getgameexpconfig();
             $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/backend.css'; 
             
             }
             else if($file=='usermanager')
             {
             
             $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/backend.css'; 
             }
             
           
           } else
           {
              $file="mediamanage";  
              $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/backend.css'; 
           }
           
                                                                                             
           
           $arraynewdata['folderset']=$folder;
           
           $arraynewdata['cssdata'][]=baseinfo.'/css/theme1/addcontent.css';
           
           
           $this->loadtemplate($file,$arraynewdata,$folder);
           //echo "affiliate";
           
           
           }
        
        
        }
?>